#pragma once
#include"HashTable.h"
namespace My
{
	template<class K>
	class unordered_set
	{
		struct Set_KOfT
		{
			const K& operator()(const K& key)
			{
				return key;
			}
		};
	public:
		typedef typename Hash_Bucket::HashTable<K, const K,Set_KOfT>::iterator iterator;
		typedef typename Hash_Bucket::HashTable<K, const K, Set_KOfT>::const_iterator const_iterator;
		pair<iterator, bool> insert(const K& key)
		{
			return _ht.insert(key);
		}
		iterator erase(const K& key)
		{
			return _ht.erase(key);
		}
		iterator find(const K& key)
		{
			return _ht.find(key);
		}
		iterator begin()
		{
			return _ht.begin();
		}
		iterator end()
		{
			return _ht.end();
		}
		const_iterator cbegin()
		{
			return _ht.cbegin();
		}
		const_iterator cend()
		{
			return _ht.cend();
		}
	private:
		Hash_Bucket::HashTable<K,const K,Set_KOfT> _ht;
	};
	void Test01()
	{
		unordered_set<int> ht;
		int a[] = { 9,55,2,1,7,6,11,21,21 };
		for (auto x : a)
		{
			ht.insert(x);
		}
		unordered_set<int>::iterator it = ht.cbegin();
		while (it != ht.cend())
		{
			cout << *it << " ";
			++it;
		}
	}
}